"""
Copyright (C) 2008 Masahiro Nakao

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
"""

import random_org

class Gene_rc:
    # Input a very big/small value to init_value, if you input init_value
    def __init__(self, init_value=99999):
        self.chrom = []
        self.value = init_value
    
    def __cmp__(self, other):
        return cmp(self.value, other.value)

    def init_chrom(self, r, number_of_dimensions, max_value, min_value):
        for i in range(number_of_dimensions):
            self.chrom.append(r.uniform(min_value, max_value))
 #           self.chrom.append(r.test_uniform())

    def get_value(self):
        return self.value
    
    def set_value(self, value):
        self.value = value
        
    def get_chrom(self):
        return self.chrom
    
    def set_chrom(self, chrom):
        self.chrom = chrom
